package com.mtt.erp.common.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Tree<T> {
    @ApiModelProperty(
            value = "主键ID",
            required = true
    )
    private String id;
    @ApiModelProperty(
            value = "key,唯一标识"
    )
    private String key;
    @ApiModelProperty(
            value = "图标"
    )
    private String icon;
    @ApiModelProperty(
            value = "名称"
    )
    private String title;
    @ApiModelProperty(
            value = "值"
    )
    private String value;
    @ApiModelProperty(
            value = "内容"
    )
    private String text;
    @ApiModelProperty(
            value = "权限"
    )
    private String permission;
    @ApiModelProperty(
            value = "类型"
    )
    private String type;
    @ApiModelProperty(
            value = "排序"
    )
    private Double order;
    @ApiModelProperty(
            value = "地址"
    )
    private String path;
    @ApiModelProperty(
            value = "组件"
    )
    private String component;
    @ApiModelProperty(
            value = "子记录"
    )
    private List<Tree<T>> children;
    @ApiModelProperty(
            value = "父级Id"
    )
    private String parentId;
    @ApiModelProperty(
            value = "是否有上级"
    )
    private boolean hasParent = false;
    @ApiModelProperty(
            value = "是否有下级"
    )
    private boolean hasChildren = false;
    @ApiModelProperty(
            value = "创建时间"
    )
    private Date createTime;
    @ApiModelProperty(
            value = "修改时间"
    )
    private Date modifyTime;
    @ApiModelProperty(
            value = "编号"
    )
    private String code;
    @ApiModelProperty(
            value = "状态"
    )
    private String status;//状态
    public void initChildren(){
        this.children = new ArrayList<>();
    }

}
